abstract class Animal {
    String name;
    String callvoice;

    abstract void cry();
    abstract String getAnimalName(String n);

    public void setAnimalName(String n) {
        this.name = n;
    }
}

class Simulator{
    public void playSound(Animal animal){
        animal.cry();
    }
}
class Dog extends Animal {
    
    void cry() {
        System.out.println("汪！"); 
    }

    
    String getAnimalName(String n) {
        this.name = n; 
        return this.name; 
    }
}class Cat extends Animal {
    
    
    void cry() {
        System.out.println("喵!"); 
    }

    
    String getAnimalName(String n) {
        this.name = n; 
        return this.name; 
    }
}
public class Application {
    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.getAnimalName("狗");

        Cat cat = new Cat();
        cat.getAnimalName("猫");

        Simulator simulator = new Simulator(); 

        
        System.out.println(dog.getAnimalName("狗") + " 的声音是：");
        simulator.playSound(dog); 

        System.out.println(cat.getAnimalName("猫") + " 的声音是：");
        simulator.playSound(cat); 
    }
}

